package everydayGrade.t3;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: Siantar
 * @Date: 2023-09-27-14:31
 * @Description: 1.0
 */
public class T1333 {
    public List<Integer> filterRestaurants(int[][] restaurants, int veganFriendly, int maxPrice, int maxDistance) {
        return Arrays.stream(restaurants).filter(e -> (veganFriendly == 0 || e[2] == 1) && e[3] <= maxPrice && e[4] <= maxDistance).sorted((a, b) -> a[1] == b[1] ? b[0] - a[0] : b[1] - a[1]).map(e -> e[0]).collect(Collectors.toList());
    }
}
